package com.nd.qa.test.common;

import android.content.Context;
import android.util.Log;

public class InputDataStore {

    private static final String TAG = "ROBOT";

    private String Input_TargetPakage;

    private String ExternalStorageDirectory;

    private String Input_LogPath;

    private String Input_LogImagePath;

    private String Input_LogCrash;
    
    private String Input_CoordsPath;//图片坐标信息文件路径

    private String Input_TargetActivity;

    private int Input_Retrytime=2;

    private InputDataStore() {
    }

    private static InputDataStore inputDataStore = null;

    public static InputDataStore getInstance() {
        if (inputDataStore == null) {
            inputDataStore = new InputDataStore();
        }
        return inputDataStore;
    }

    public void init(Context context) {
        if (context != null) {
            setInput_TargetPakage(context.getPackageName());
            setExternalStorageDirectory(context.getExternalCacheDir().getAbsolutePath());//context.getApplicationContext().getPackageResourcePath()  context.getExternalCacheDir().getAbsolutePath()
            Log.i("ROBOT", getExternalStorageDirectory()+ "/Results/");
            setInput_LogPath(getExternalStorageDirectory() + getInput_TargetPakage() + "/Result/");
            setInput_LogImagePath(getInput_LogPath() + "images/");
            setInput_LogCrash(getInput_LogPath() + "crash/");
            setInput_CoordsPath(getInput_LogPath()+"coords/");
            Log.e(TAG, "Input_TargetPakage" + Input_TargetPakage);
            Log.e(TAG, "ExternalStorageDirectory" + ExternalStorageDirectory);
            Log.e(TAG, "Input_LogPath" + Input_LogPath);
            Log.e(TAG, "Input_LogImagePath" + Input_LogImagePath);
            Log.e(TAG, "Input_LogCrash" + Input_LogCrash);
        } else {
            Log.e(TAG,"初始化失败："+"无法获取目标apk");
        }
    }

    
    
    public String getInput_CoordsPath() {
		return Input_CoordsPath;
	}

	public void setInput_CoordsPath(String input_CoordsPath) {
		Input_CoordsPath = input_CoordsPath;
	}

	public int getInput_Retrytime() {
        return Input_Retrytime;
    }

    public void setInput_Retrytime(int input_Retrytime) {
        Input_Retrytime = input_Retrytime;
    }

    public void setInput_TargetActivity(String action) {
        Log.e(TAG, "launcher activity=====" + action);
        Input_TargetActivity = action;
    }

    public String getInput_TargetPakage() {
        return Input_TargetPakage;
    }

    public void setInput_TargetPakage(String input_TargetPakage) {
        Input_TargetPakage = input_TargetPakage;
    }

    public String getExternalStorageDirectory() {
        return ExternalStorageDirectory;
    }

    public void setExternalStorageDirectory(String externalStorageDirectory) {
        ExternalStorageDirectory = externalStorageDirectory + "/";
    }

    public String getInput_LogPath() {
        return Input_LogPath;
    }

    public void setInput_LogPath(String input_LogPath) {
        Input_LogPath = input_LogPath;
    }

    public String getInput_LogImagePath() {
        return Input_LogImagePath;
    }

    public void setInput_LogImagePath(String input_LogImagePath) {
        Input_LogImagePath = input_LogImagePath;
    }

    public String getInput_LogCrash() {
        return Input_LogCrash;
    }

    public void setInput_LogCrash(String input_LogCrash) {
        Input_LogCrash = input_LogCrash;
    }

    public String getInput_TargetActivty() {
        return Input_TargetActivity;
    }
}
